<?php

namespace app\api\middleware;
use app\admin\model\Details;
use app\common\controller\Api;
use think\Controller;
use think\exception\HttpException;
use think\Response;


class RoleCheck extends Controller
{
    public static function role($uid, $role)
    {
        $user = Details::where('user_id', '=', $uid)->where('login_status', '=', '正常')
            ->where('role', '=', $role)
            ->find();
        if (!$user) {
            fail('您无该访问权限');
        }else{
            return $user;
        }
    }


}